package com.cq.androidtools.recycleview

import android.content.Context
import android.os.Bundle
import android.widget.GridView
import androidx.appcompat.app.AppCompatActivity
import com.cq.androidtools.R


/**
 * 作者: CQ
 * 日期: 2021-03-16
 * 说明: 实例
 */
class RecycleviewActivity4 : AppCompatActivity() {
    private lateinit var rv_user: GridView
    private lateinit var context: Context
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_grid)
        initView()
    }

    override fun onDestroy() {
        super.onDestroy()
    }

    private fun initView() {
        context = this
        rv_user = findViewById<GridView>(R.id.rv_user)
        rv_user.numColumns = 3
        val list = mutableListOf<String>()
        for (i in 0..10){
            list.add(i.toString())
        }
        rv_user.adapter = MyAdapter(list, context)


    }


}

